﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
using System.IO;
#if UNITY_EDITOR
using UnityEditor;
#endif 
namespace SpaceDFramework
{
    /// <summary>
    /// 创建自定义模板的文件
    /// </summary>
    public class CreateCustomFile : MonoBehaviour
    {
#if UNITY_EDITOR
        [MenuItem("Assets/Create/Menu(菜单模板)",false,1)]

        static void CreateEditor() {
            ProjectWindowUtil.StartNameEditingIfProjectWindowExists(0,
        ScriptableObject.CreateInstance<EditorUtil.CreateScriptAsset>(),
        EditorUtil.GetSelectedPathOrFallback() + "/NewMenuScript.cs",
        null,
        Application.dataPath + "/SpaceDFramework/Resources/Templates/NewEditorScript.cs.txt");
        }
#endif
#if UNITY_EDITOR
        [MenuItem("Assets/Create/Markdown(笔记)", false, 2)]

        static void CreateMarkdown()
        {
            ProjectWindowUtil.StartNameEditingIfProjectWindowExists(0,
        ScriptableObject.CreateInstance<EditorUtil.CreateScriptAsset>(),
        EditorUtil.GetSelectedPathOrFallback() + "/Newmarkdown.md",
        null,
        Application.dataPath + "/SpaceDFramework/Resources/Templates/NewMarkdown.md.txt");
        }
#endif
#if UNITY_EDITOR
        [MenuItem("Assets/Create/BehaviourScript(脚本)", false, 3)]
        static void CreateMyScript()
        {
            ProjectWindowUtil.StartNameEditingIfProjectWindowExists(0,
        ScriptableObject.CreateInstance<EditorUtil.CreateScriptAsset>(),
        EditorUtil.GetSelectedPathOrFallback() + "/NewBehaviourScript.cs",
        null,
        Application.dataPath + "/SpaceDFramework/Resources/Templates/NewBehaviourScript.cs.txt");
        }
#endif 
    }
}
